import Vue from 'vue';
import Router from 'vue-router';
import Index from './views/Index.vue';
import Register from './views/Register';
import Nofind from './views/404';
import Login from '@/views/Login.vue';
import Home from '@/views/Home.vue';
import Echarts from '@/components/Echarts.vue';
import Form from '@/views/ForumCenter/form.vue';
import Activity from '@/views/PartyBuildingActivityCenter/activity.vue';
import ActivityLog from './views/PartyBuildingActivityCenter/activitylog.vue'
import LearningDatas from './views/LearningDatabaseCenter/learningdatas.vue'
import User from './views/MemberManageCenter/user.vue'
import AnnouncementCenter from '@/views/AnnouncementCenter/AnnouncementManage.vue'
import AddAnnouncement from "@/views/AnnouncementCenter/AddAnnouncement.vue";
import AnnouncementCheck from "@/views/ReviewCenter/announcementcheck.vue";
import ActivityCheck from "@/views/ReviewCenter/activitycheck.vue";
import learningdatascheck from './views/ReviewCenter/learningdatascheck.vue';
import formcheck from './views/ReviewCenter/formcheck.vue';

Vue.use(Router)

const router = new Router({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes: [
        {path: '*', name: '/404', component: Nofind},
        {path: '/', redirect: '/index'},
        {path: '/register', name: 'register', component: Register},
        {
            path: '/index',
            name: 'index',
            component: Index,
            children: [
                // 主页
                {path: '', component: Home},
                {path: '/home', name: 'home', component: Home},
                // { path: '/infoshow', name: 'infoshow', component: InfoShow },
                // { path: '/foundlist', name: 'foundlist', component: FoundList },
                // { path: '/tablelist', name: 'table', component: TableList },
                {path: '/echarts', name: 'echarts', component: Echarts},
                // { path: '/form', name: 'form', component: Form },
                // 公告管理
                {
                    path: '/announcement',
                    name: "announcement",
                    component: AnnouncementCenter
                },
                // 发布公告
                {
                    path: '/addannouncement',
                    name: "addannouncement",
                    component: AddAnnouncement
                },
                // 党建活动管理
                {path: '/activity', name: 'activity', component: Activity},
                // 党员信息管理
                {path: '/user', name: 'user', component: User},
                // 党建活动统计管理
                {path: '/activityLog', name: 'activityLog', component: ActivityLog},
                // 学习资料库管理
                {path: '/learningdatas', name: 'learningdatas', component: LearningDatas},
                // 互动交流平台管理
                {path: '/forum', name: 'forum', component: Form},
                // 公告审核
                {path: '/announcementcheck', name: 'announcementcheck', component: AnnouncementCheck},
                // 活动审核
                {path: '/activitycheck', name: 'activitycheck', component: ActivityCheck},
                // 学习资料审核
                {path: '/learningdatascheck', name: 'learningdatascheck', component: learningdatascheck},
                // 论坛审核
                {path: '/formcheck', name: 'formcheck', component: formcheck}
            ]
        },
    ]
})

// 添加路由守卫
router.beforeEach((to, from, next) => {
    next();
})

export default router;